package org.mm.proxycache.http;

import java.util.Map;

import com.google.common.collect.Multimap;

public interface HttpMessage
{
    /**
     * Returns the version of the protocol associated with this request.
     */
    HttpVersion version();

    /**
     * Gets the <tt>Content-Type</tt> header of the request.
     * 
     * @return The content type.
     */
    String contentType();

    /**
     * Determines whether the HTTP connection should remain open after handling
     * this request. If the request is a <code>HTTP/1.1</code> request, we
     * keep the connection alive unless an explicit
     * <code>"Connection: close"</code> header is sent.<br/> Otherwise, the
     * connection is only kept alive if an explicit
     * <code>"Connection: keep-alive"</code> header is sent
     * 
     * @return <code>true</code> if the connection should remain open
     *         following the handling of this request
     */
    boolean isKeepAlive();

    boolean isProxyKeepAlive();

    /**
     * Returns the value of the HTTP header with the specified name. If more
     * than one header with the given name is associated with this request, one
     * is selected and returned.
     * 
     * @param name
     *            The name of the desired header
     * @return The header value - or null if no header is found with the
     *         specified name
     */
    String header( String name );

    Multimap<String, String> getHeaders();

    /**
     * Returns <tt>true</tt> if the HTTP header with the specified name exists
     * in this request.
     */
    boolean hasHeader( String name );

    long contentLength();

    long realSize();

    boolean isChunked();

    Map<String, String> cacheControl();

    Map<String, String> keepAliveValues();

    void setCurrentDate();

}
